package com.colorfruit.framework.model.pojo;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

/**
 * 业务描述：
 *
 * @Auther: chenjiayuan
 * @Date: create in 2018/7/3 21
 * @Description:
 */
@Data
@ToString
@NoArgsConstructor
public class BaseResult<T extends Object> {
    private String code;
    private String msg;
    private T data;

    public BaseResult(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public BaseResult(T data) {
        this.code = BaseErrorCodeEnum.SUCCESS.getCode();
        this.msg = BaseErrorCodeEnum.SUCCESS.getMsg();
        this.data = data;
    }

    public BaseResult(T data, String code, String msg){
        this.data = data;
        this.code = code;
        this.msg = msg;
    }

    public BaseResult(BaseErrorCodeEnum baseErrorCodeEnum){
        this.code = baseErrorCodeEnum.getCode();
        this.msg = baseErrorCodeEnum.getMsg();
    }


}
